using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnemyTower : TankBaseObj
{
    //间隔开火时间
    public float fireOffsetTime = 1;
    private float nowTime = 0;
    //发射位置
    public Transform[] shootPos;
    //子弹预设体
    public GameObject bulletObj;

    public override void Fire()
    {
        foreach (var item in shootPos)
        {
            GameObject obj = Instantiate(bulletObj, item.position, item.rotation);
            //设置子弹拥有者, 方便进行属性计算
            obj.GetComponent<BulletObj>().setFather(this);
        }
    }

    private void Update()
    {
        nowTime += Time.deltaTime;
        if (nowTime >= fireOffsetTime)
        {
            Fire();
            nowTime = 0;
        }
    }

    public override void Wound(TankBaseObj other)
    {
        //base.Wound(other);
        //取消调用父类方法, 让当前坦克不会受伤
    }
}
